Repository navigation
Fix local mode with Odoo 11 to 20 - #63
Merged
Merged
Conversation
Odoo browse() needs plain integers, and a lazy search is executed first. Add tests for Env.cr, Env.odoo_env and with_odoo() in local mode, and check they are not available otherwise.
- Odoo 19: import odoo.http, which imports odoo.init (core setup), the registry and the services - database list, selection, create/clone/drop with the 'db' service (client.database was only available for Web servers since 3.0) - CLI: option -c passes a str to Odoo, and 'scheme = local' environments can be cached and reused; PGAPPNAME=odooly - clear errors for Webclient-only features: Superuser, session_authenticate() and render_pdf() - from_config() switches back to the database of the environment - tests: fake odoo package for 18 and 19
Odoo 20 moved dispatch_rpc to odoo.http.router and removed the 'db'
service: database management is rebuilt on odoo.modules.db. The
dispatcher is kept as odoo._dispatch_rpc, instead of patching odoo.http.
The user context is a read-only mapping in local mode.
Tests for Odoo 11, 12 and 20: check the signatures of the 'db' service
per version ('phone' since 12.0, 'neutralize_database' since 16.0), and
Environment.reset() before 15.0.
florentx
force-pushed
the
fix/local-mode
branch
from
November 27, 2026 09:44
50a28a4 to
9e24d69
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Local mode (
scheme = local, orodooly -c odoo.conf) had several bugs in 3.x, and didn't work at all with Odoo 19. This PR fixes it, and tests it with Odoo 11 and later.import odoono longer loads the sub-packages. odooly now importsodoo.http, which runsodoo.init(core setup and monkey patches).dispatch_rpcmoved toodoo.http.router, and thedbservice was removed. Database management is rebuilt onodoo.modules.db. The user context is now a read-only mapping.client.databaseonly existed for Web servers. Database list, selection, create, clone and drop now use thedbservice.-c odoo.confandscheme = localenvironments crashed, andPGAPPNAMEwasclient.pyinstead ofodooly.session_authenticate(),render_pdf().from_config()switches back to the environment's database when the client is reused.with_odoo()crashed for aRecordand for a lazyRecordList.Local mode needs Odoo 11.0 or later: Odoo 9 and 10 run only on Python 2.
Testing
tests/test_local.py, with a fakeodoopackage for Odoo 11, 12, 18, 19 and 20, including each version'sdbservice signatures.🤖 Co-authored with Claude Code